# Maintainer: Caleb Maclennan <caleb@alerque.com>
# Contributor: grandchild

pkgbase=python-pyclipper
_pyname=pyclipper
pkgname="python-$_pyname"
pkgver=1.3.0.post5
pkgrel=1
pkgdesc='Cython wrapper for the C++ translation of the Angus Johnson’s Clipper library'
url="https://github.com/fonttools/$_pyname"
arch=(loong64 x86_64 i686)
license=(MIT)
depends=(python)
makedepends=(cython
             python-{build,installer,wheel}
             python-setuptools-scm)
_archive="$_pyname-$pkgver"
source=("https://files.pythonhosted.org/packages/source/${_pyname::1}/$_pyname/$_archive.tar.gz"
        update-scm-version.patch)
sha256sums=('c0239f928e0bf78a3efc2f2f615a10bfcdb9f33012d46d64c8d1225b4bde7096'
            '0e3cf27a376ba54c15c05b2cc6bbacd55ca7984ebe326ce4d825058a69c1a087')

prepare() {
	cd "$_archive"
	patch -p1 -i "$srcdir/${source[1]}"
}

build() {
	cd "$_archive"
	python -m build -wn
}

package() {
	cd "$_archive"
	python -m installer -d "$pkgdir" dist/*.whl
	install -Dm0644 -t "$pkgdir/usr/share/licenses/$pkgname/" LICENSE
}
